package day2;

public class ArrayTest {
    public void demo(){
        //静态初始化
        int[] intArr;
        intArr = new int[]{1000,2,3,4};
        Object[] objectArr;
        objectArr = new String[]{"test","php"};

        int[] good = {12,3,4};

        //动态初始化  会有默认值
        int[] prices = new int[5];
        Object[] books = new String[5];
        Object[] pencils = new String[]{"a","b","c"};
        books[0] = "PHP";
        books[1] = "Java";

        //循环获取数组元素
        for(int i=0;i<intArr.length;i++){
            System.out.println("intArr数组的元素--"+intArr[i]);
        }

        for(int j=0;j<books.length;j++){
            System.out.println("books数组的元素--"+books[j]);
        }


        for (Object pencil:pencils) {
            System.out.println("pencil数组的元素--"+pencil);
        }

        System.out.println(intArr[1]);

        //内存中的数组


    }
}
